﻿@using giaoxuhaison.Models;

@{
    Layout = null;    
}

@{
    var lstItem = (List<vw_All_Index>)ViewData["lstAll"];
    var lstNews = lstItem.Where(t => t.GroupID == 1 || t.GroupID == 2).ToList();
    var lstNews_2 = lstItem.Where(t => t.GroupID == 3 || t.GroupID == 4).ToList();
    var lstGodTitle = lstItem.Where(t => t.GroupID == 5 || t.GroupID == 6 || t.GroupID == 7 || t.GroupID == 8).ToList();
    var lstFaith = lstItem.Where(t => t.GroupID == 11 || t.GroupID == 12).ToList();
    var lstCulture = lstItem.Where(t => t.GroupID == 13 || t.GroupID == 14).ToList();
    var lstLiturgy = lstItem.Where(t => t.GroupID == 9 || t.GroupID == 10).ToList();
    var lstBible = lstItem.Where(t => t.GroupID == 50 || t.GroupID == 51).ToList();
}
<!--tin tuc-->
@if (lstNews != null && lstNews.Count > 0)
{
    <div class="Newsbox dai bo" >
        <div class="tit1" id="box">
            <ul>
                        <li><a  href='@Url.Action("NewsGroup", "News", new { GroupID = 2 })'>Tin Giáo Phận</a></li>
                
                        <li>&nbsp;|&nbsp;</li>
                
                        <li><a  href='@Url.Action("NewsGroup", "News", new { GroupID = 1 })'>Sinh hoạt Giáo Xứ</a></li>               
            </ul>
            <h3>
                <a  href='@Url.Action("NewsGroup", "News", new { GroupID = 1 })'><b>TIN TỨC</b></a>
            </h3>
        </div>
        <div class="NewsBoxDetail" >
            <div id="BoxDetail">
                <a  title='@lstNews[0].Subject' href='@Url.Action("NewsDetail", "News", new { NewsID = lstNews[0].NewsID, GroupID = lstNews[0].GroupID })'>
                <img width="150" border="0" alt='@lstNews[0].Subject' src='@Url.Content(lstNews[0].ImageContentUrl)' class="thumbvtc" align="left"></a>
                <a class="p2_menuchinh" title='@lstNews[0].Subject' href='@Url.Action("NewsDetail", "News", new { NewsID = lstNews[0].NewsID, GroupID = lstNews[0].GroupID })'>
                @lstNews[0].Subject
                @{
                    TimeSpan diff = DateTime.Today.Date - lstNews[0].CreationDate.Date;
                            
                    if(Int32.Parse(diff.Days.ToString()) <= 3)
                    {
                        <img  src='@Url.Content("~/Images/red-star.gif")' alt = ""/>
                    }
                }
                </a>
                <br />
                <br />                
                @lstNews[0].ShortcutText...
            </div>
            <div class="clear"></div>
            @{
                    var j = 0;
                    if (lstNews.Count > 4)
                    {
                        j = 3;
                    }
                    else
                    {
                        j = lstNews.Count - 1;
                    }
                    for (int i = 1; i <= j; i++)
                    {
                    <div class="boxOther">
                        <div class="NewsBoxOther"><a href='@Url.Action("NewsDetail", "News", new { NewsID = lstNews[i].NewsID, GroupID = lstNews[i].GroupID })'>
                        <i>>> @lstNews[i].Subject</i>
                        @{
                        TimeSpan diff_t = DateTime.Today.Date - lstNews[i].CreationDate.Date;

                        if (Int32.Parse(diff_t.Days.ToString()) <= 3)
                        {
                            <img  src='@Url.Content("~/Images/red-star.gif")' alt = ""/>
                        }
                        }
                        </a></div>                        
                    </div>
                    }
            }
        </div>
    </div>
}

<!--Giáo hội-->
@if (lstNews_2 != null && lstNews_2.Count > 0)
{
    <div class="Newsbox dai bo" >
        <div class="tit1" id="box">
            <ul>
                        <li><a  href='@Url.Action("NewsGroup", "News", new { GroupID = 4 })'>Hoàn Vũ</a></li>
                
                        <li>&nbsp;|&nbsp;</li>
                
                        <li><a  href='@Url.Action("NewsGroup", "News", new { GroupID = 3 })'>Việt Nam</a></li>               
            </ul>
            <h3>
                <a  href='@Url.Action("NewsGroup", "News", new { GroupID = 3 })'><b>GIÁO HỘI</b></a>
            </h3>
        </div>
        <div class="NewsBoxDetail" >
            <div id="BoxDetail">
                <a  title='@lstNews_2[0].Subject' href='@Url.Action("NewsDetail", "News", new { NewsID = lstNews_2[0].NewsID, GroupID = lstNews_2[0].GroupID })'>
                <img width="150" border="0" alt='@lstNews_2[0].Subject' src='@Url.Content(lstNews_2[0].ImageContentUrl)' class="thumbvtc" align="left"></a>
                <a class="p2_menuchinh" title='@lstNews_2[0].Subject' href='@Url.Action("NewsDetail", "News", new { NewsID = lstNews_2[0].NewsID, GroupID = lstNews_2[0].GroupID })'>
                @lstNews_2[0].Subject
                @{
                    TimeSpan diff = DateTime.Today.Date - lstNews_2[0].CreationDate.Date;
                            
                    if(Int32.Parse(diff.Days.ToString()) <= 3)
                    {
                        <img  src='@Url.Content("~/Images/red-star.gif")' alt = ""/>
                    }
                }
                </a>
                <br />
                <br />
                @lstNews_2[0].ShortcutText...
            </div>
            <div class="clear"></div>
            @{
                var j = 0;
                if (lstNews_2.Count > 4)
                {
                    j = 3;
                }
                else
                {
                    j = lstNews_2.Count - 1;
                }
                for (int i = 1; i <= j; i++)
                {
                    <div class="boxOther">
                        <div class="NewsBoxOther"><a href='@Url.Action("NewsDetail", "News", new { NewsID = lstNews_2[i].NewsID, GroupID = lstNews_2[i].GroupID })'>
                        <i>>> @lstNews_2[i].Subject</i>
                        @{
                            TimeSpan diff_t = DateTime.Today.Date - lstNews_2[i].CreationDate.Date;

                            if (Int32.Parse(diff_t.Days.ToString()) <= 3)
                            {
                                <img  src='@Url.Content("~/Images/red-star.gif")' alt = ""/>
                            }
                        }
                        </a></div>                        
                    </div>
                }
            }
        </div>
    </div>
}

<!--lời Chúa-->
@if (lstGodTitle != null && lstGodTitle.Count > 0)
{
    <div class="Newsbox dai bo" >
        <div class="tit1" id="box">
            <ul>
                        <li><a  href='@Url.Action("GodTitleGroup", "GodTitle", new { GroupID = 8 })'>5 phút Lời Chúa</a></li>
                
                        <li>&nbsp;|&nbsp;</li>
                        <li><a  href='@Url.Action("GodTitleGroup", "GodTitle", new { GroupID = 7 })'>Trong Tuần</a></li>
                
                        <li>&nbsp;|&nbsp;</li>
                        <li><a  href='@Url.Action("GodTitleGroup", "GodTitle", new { GroupID = 6 })'>Lễ Trọng</a></li>
                
                        <li>&nbsp;|&nbsp;</li>
                
                        <li><a  href='@Url.Action("GodTitleGroup", "GodTitle", new { GroupID = 5 })'>Chúa Nhật</a></li>               
            </ul>
            <h3>
                <a  href='@Url.Action("GodTitleGroup", "GodTitle", new { GroupID = 5 })'><b>LỜI CHÚA</b></a>
            </h3>
        </div>
        <div class="NewsBoxDetail" >
            <div id="BoxDetail">
                <a  title='@lstGodTitle[0].Subject' href='@Url.Action("GodTitleDetail", "GodTitle", new { GodTitleID = lstGodTitle[0].NewsID, GroupID = lstGodTitle[0].GroupID })'>
                <img width="150" border="0" alt='@lstGodTitle[0].Subject' src='@Url.Content(lstGodTitle[0].ImageContentUrl)' class="thumbvtc" align="left"></a>
                <a class="p2_menuchinh" title='@lstGodTitle[0].Subject' href='@Url.Action("GodTitleDetail", "GodTitle", new { GodTitleID = lstGodTitle[0].NewsID, GroupID = lstGodTitle[0].GroupID })'>
                @lstGodTitle[0].Subject
                @{
                    TimeSpan diff = DateTime.Today.Date - lstGodTitle[0].CreationDate.Date;
                            
                    if(Int32.Parse(diff.Days.ToString()) <= 3)
                    {
                        <img  src='@Url.Content("~/Images/red-star.gif")' alt = ""/>
                    }
                }
                </a>
                <br />
                <br />
                @lstGodTitle[0].ShortcutText...
            </div>
            <div class="clear"></div>
            @{
                var j = 0;
                if (lstGodTitle.Count > 4)
                {
                    j = 3;
                }
                else
                {
                    j = lstGodTitle.Count - 1;
                }
                for (int i = 1; i <= j; i++)
                {
                    <div class="boxOther">
                        <div class="NewsBoxOther"><a href='@Url.Action("GodTitleDetail", "GodTitle", new { GodTitleID = lstGodTitle[i].NewsID, GroupID = lstGodTitle[i].GroupID })'>
                        <i>>> @lstGodTitle[i].Subject</i>
                        @{
                            TimeSpan diff_t = DateTime.Today.Date - lstGodTitle[i].CreationDate.Date;

                            if (Int32.Parse(diff_t.Days.ToString()) <= 3)
                            {
                                <img  src='@Url.Content("~/Images/red-star.gif")' alt = ""/>
                            }
                        }
                        </a></div>                        
                    </div>
                }
            }
        </div>
    </div>
}

<!--phụng vụ-->
@if (lstLiturgy != null && lstLiturgy.Count > 0)
{
    <div class="Newsbox dai bo" >
        <div class="tit1" id="box">
            <ul>
                        <li><a  href='@Url.Action("LiturgyGroup", "Liturgies", new { GroupID = 10 })'>Hạnh các Thánh</a></li>
                
                        <li>&nbsp;|&nbsp;</li>
                
                        <li><a  href='@Url.Action("LiturgyGroup", "Liturgies", new { GroupID = 9 })'>Trong tuần</a></li>               
            </ul>
            <h3>
                <a  href='@Url.Action("LiturgyGroup", "Liturgies", new { GroupID = 10 })'><b>PHỤNG VỤ</b></a>
            </h3>
        </div>
        <div class="NewsBoxDetail" >
            <div id="BoxDetail">
                <a  title='@lstLiturgy[0].Subject' href='@Url.Action("LiturgyDetail", "Liturgies", new { LiturgyID = lstLiturgy[0].NewsID, GroupID = lstLiturgy[0].GroupID })'>
                <img width="150" border="0" alt='@lstLiturgy[0].Subject' src='@Url.Content(lstLiturgy[0].ImageContentUrl)' class="thumbvtc" align="left"></a>
                <a class="p2_menuchinh" title='@lstLiturgy[0].Subject' href='@Url.Action("LiturgyDetail", "Liturgies", new { LiturgyID = lstLiturgy[0].NewsID, GroupID = lstLiturgy[0].GroupID })'>
                @lstLiturgy[0].Subject
                @{
                    TimeSpan diff = DateTime.Today.Date - lstLiturgy[0].CreationDate.Date;
                            
                    if(Int32.Parse(diff.Days.ToString()) <= 3)
                    {
                        <img  src='@Url.Content("~/Images/red-star.gif")' alt = ""/>
                    }
                }
                </a>
                <br />
                <br />
                @lstLiturgy[0].ShortcutText...
            </div>
            <div class="clear"></div>
            @{
                var j = 0;
                if (lstLiturgy.Count > 4)
                {
                    j = 3;
                }
                else
                {
                    j = lstLiturgy.Count - 1;
                }
                for (int i = 1; i <= j; i++)
                {
                    <div class="boxOther">
                        <div class="NewsBoxOther"><a href='@Url.Action("LiturgyDetail", "Liturgies", new { LiturgyID = lstLiturgy[i].NewsID, GroupID = lstLiturgy[i].GroupID })'>
                        <i>>> @lstLiturgy[i].Subject</i>
                        @{
                            TimeSpan diff_t = DateTime.Today.Date - lstLiturgy[i].CreationDate.Date;

                            if (Int32.Parse(diff_t.Days.ToString()) <= 3)
                            {
                                <img  src='@Url.Content("~/Images/red-star.gif")' alt = ""/>
                            }
                        }
                        </a></div>                        
                    </div>
                }
            }
        </div>
    </div>
}

<!--Sống đức tin-->
@if (lstFaith != null && lstFaith.Count > 0)
{
    <div class="Newsbox dai bo" >
        <div class="tit1" id="box">
            <ul>
                        <li><a  href='@Url.Action("FaithsGroup", "Faiths", new { GroupID = 12 })'>Sống đạo</a></li>
                
                        <li>&nbsp;|&nbsp;</li>
                
                        <li><a  href='@Url.Action("FaithsGroup", "Faiths", new { GroupID = 11 })'>Giáo lý</a></li>               
            </ul>
            <h3>
                <a  href='@Url.Action("FaithsGroup", "Faiths", new { GroupID = 11 })'><b>SỐNG ĐỨC TIN</b></a>
            </h3>
        </div>
        <div class="NewsBoxDetail" >
            <div id="BoxDetail">
                <a  title='@lstFaith[0].Subject' href='@Url.Action("FaithsDetail", "Faiths", new { FaithID = lstFaith[0].NewsID, GroupID = lstFaith[0].GroupID })'>
                <img width="150" border="0" alt='@lstFaith[0].Subject' src='@Url.Content(lstFaith[0].ImageContentUrl)' class="thumbvtc" align="left"></a>
                <a class="p2_menuchinh" title='@lstFaith[0].Subject' href='@Url.Action("FaithsDetail", "Faiths", new { FaithID = lstFaith[0].NewsID, GroupID = lstFaith[0].GroupID })'>
                @lstFaith[0].Subject
                @{
                    TimeSpan diff = DateTime.Today.Date - lstFaith[0].CreationDate.Date;
                            
                    if(Int32.Parse(diff.Days.ToString()) <= 3)
                    {
                        <img  src='@Url.Content("~/Images/red-star.gif")' alt = ""/>
                    }
                }
                </a>
                <br />
                <br />
                @lstFaith[0].ShortcutText...
            </div>
            <div class="clear"></div>
            @{
                var j = 0;
                if (lstFaith.Count > 4)
                {
                    j = 3;
                }
                else
                {
                    j = lstFaith.Count - 1;
                }
                for (int i = 1; i <= j; i++)
                {
                    <div class="boxOther">
                        <div class="NewsBoxOther"><a href='@Url.Action("FaithsDetail", "Faiths", new { FaithID = lstFaith[i].NewsID, GroupID = lstFaith[i].GroupID })'>
                        <i>>> @lstFaith[i].Subject</i>
                        @{
                            TimeSpan diff_t = DateTime.Today.Date - lstFaith[i].CreationDate.Date;

                            if (Int32.Parse(diff_t.Days.ToString()) <= 3)
                            {
                                <img  src='@Url.Content("~/Images/red-star.gif")' alt = ""/>
                            }
                        }
                        </a></div>                        
                    </div>
                }
            }
        </div>
    </div>
}

<!--Thanh kinh-->
@if (lstBible != null && lstBible.Count > 0)
{
    <div class="Newsbox dai bo" >
        <div class="tit1" id="box">
            <ul>
                        <li><a  href='@Url.Action("BibleGroup", "Bibles", new { GroupID = 50 })'>Vui Học Thánh Kinh</a></li>  
                        <li>&nbsp;|&nbsp;</li>                
                        <li><a  href='@Url.Action("BibleGroup", "Bibles", new { GroupID = 51 })'>Thánh Kinh</a></li>               
                                    
            </ul>
            <h3>
                <a  href='@Url.Action("BibleGroup", "Bibles", new { GroupID = 50 })'><b>THÁNH KINH</b></a>
            </h3>
        </div>
        <div class="NewsBoxDetail" >
            <div id="BoxDetail">
                <a  title='@lstBible[0].Subject' href='@Url.Action("BibleDetail", "Bibles", new { BibleID = lstBible[0].NewsID, GroupID = lstBible[0].GroupID })'>
                <img width="150" border="0" alt='@lstBible[0].Subject' src='@Url.Content(lstBible[0].ImageContentUrl)' class="thumbvtc" align="left"></a>
                <a class="p2_menuchinh" title='@lstBible[0].Subject' href='@Url.Action("BibleDetail", "Bibles", new { BibleID = lstBible[0].NewsID, GroupID = lstBible[0].GroupID })'>
                @lstBible[0].Subject
                @{
                    TimeSpan diff = DateTime.Today.Date - lstLiturgy[0].CreationDate.Date;
                            
                    if(Int32.Parse(diff.Days.ToString()) <= 3)
                    {
                        <img  src='@Url.Content("~/Images/red-star.gif")' alt = ""/>
                    }
                }
                </a>
                <br />
                <br />
                @lstBible[0].ShortcutText...
            </div>
            <div class="clear"></div>
            @{
                var j = 0;
                if (lstBible.Count > 4)
                {
                    j = 3;
                }
                else
                {
                    j = lstBible.Count - 1;
                }
                for (int i = 1; i <= j; i++)
                {
                    <div class="boxOther">
                        <div class="NewsBoxOther"><a href='@Url.Action("BibleDetail", "Bibles", new { BibleID = lstBible[i].NewsID, GroupID = lstBible[i].GroupID })'>
                        <i>>> @lstBible[i].Subject</i>
                        @{
                            TimeSpan diff_t = DateTime.Today.Date - lstLiturgy[i].CreationDate.Date;

                            if (Int32.Parse(diff_t.Days.ToString()) <= 3)
                            {
                                <img  src='@Url.Content("~/Images/red-star.gif")' alt = ""/>
                            }
                        }
                        </a></div>                        
                    </div>
                }
            }
        </div>
    </div>
}

<!--Văn hóa-->
@if (lstCulture != null && lstCulture.Count > 0)
{
    <div class="Newsbox dai bo" >
        <div class="tit1" id="box">
            <ul>
                        <li><a  href='@Url.Action("CultureGroup", "Culture", new { GroupID = 14 })'>Truyện - thơ</a></li>
                
                        <li>&nbsp;|&nbsp;</li>
                
                        <li><a  href='@Url.Action("CultureGroup", "Culture", new { GroupID = 13 })'>Kỹ năng sống</a></li>               
            </ul>
            <h3>
                <a  href='@Url.Action("CultureGroup", "Culture", new { GroupID = 13 })'><b>VĂN HÓA</b></a>
            </h3>
        </div>
        <div class="NewsBoxDetail" >
            <div id="BoxDetail">
                <a  title='@lstFaith[0].Subject' href='@Url.Action("CultureDetail", "Culture", new { CultureID = lstCulture[0].NewsID, GroupID = lstCulture[0].GroupID })'>
                <img width="150" border="0" alt='@lstCulture[0].Subject' src='@Url.Content(lstCulture[0].ImageContentUrl)' class="thumbvtc" align="left"></a>
                <a class="p2_menuchinh" title='@lstCulture[0].Subject' href='@Url.Action("CultureDetail", "Culture", new { CultureID = lstCulture[0].NewsID, GroupID = lstCulture[0].GroupID })'>
                @lstCulture[0].Subject
                @{
                    TimeSpan diff = DateTime.Today.Date - lstCulture[0].CreationDate.Date;

                    if (Int32.Parse(diff.Days.ToString()) <= 3)
                    {
                        <img  src='@Url.Content("~/Images/red-star.gif")' alt = ""/>
                    }
                }
                </a>
                <br />
                <br />
                @lstCulture[0].ShortcutText...
            </div>
            <div class="clear"></div>
            @{
                var j = 0;
                if (lstCulture.Count > 4)
                {
                    j = 3;
                }
                else
                {
                    j = lstCulture.Count - 1;
                }
                for (int i = 1; i <= j; i++)
                {
                    <div class="boxOther">
                        <div class="NewsBoxOther"><a href='@Url.Action("CultureDetail", "Culture", new { CultureID = lstCulture[i].NewsID, GroupID = lstCulture[i].GroupID })'><i>>> 
                        @lstCulture[i].Subject</i>
                        @{
                            TimeSpan diff_t = DateTime.Today.Date - lstCulture[i].CreationDate.Date;

                            if (Int32.Parse(diff_t.Days.ToString()) <= 3)
                            {
                                <img  src='@Url.Content("~/Images/red-star.gif")' alt = ""/>
                            }
                        }
                        </a></div>                        
                    </div>
                }
            }
        </div>
    </div>
}